package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        new Thread(()->
        {
            for (int i = 0; i < 5; ++i) {
                System.out.println("rose:let me go!");
            }
            try{
                Thread.sleep(2000);
            } catch (InterruptedException e) {
//                e.printStackTrace();
            }
            System.out.println("rose:byebye");
        }).start();
      Thread jack=   new Thread(()->
        {
            while (true) {
                System.out.println("jack:you jump! i jump!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
//                    e.printStackTrace();
                }
            }
        });
      jack.setDaemon(true);
      jack.start();
//       while (true);
    }
}
